package com.xiaomengkuan.test.controller;

import com.xiaomengkuan.test.dao.CarouselRepository;
import com.xiaomengkuan.test.entity.pojo.Carousel;
import com.xiaomengkuan.test.util.R;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Faraj Mujey
 * -- Creation Time: 2021-01-01 9:41 下午, File Encoding: utf8 --
 */
@RestController
@RequestMapping("test/carousel")
@CrossOrigin
public class CarouselController {

    @Resource
    CarouselRepository carouselRepository;

    @GetMapping("all")
    public R getAllCarousel(){
        List<Carousel> all = carouselRepository.findAll();
        return R.OK().put("data",all);
    }
}
